/*
 * @lc app=leetcode.cn id=1935 lang=javascript
 *
 * [1935] 可以输入的最大单词数
 */

// @lc code=start
/**
 * @param {string} text
 * @param {string} brokenLetters
 * @return {number}
 */
var canBeTypedWords = function (text, brokenLetters) {
  return text.split(' ').filter(word => {
    let a = word.split('');
    let b = brokenLetters.split('');
    return new Set(a).size + new Set(b).size === new Set([...a, ...b]).size;
  }).length
};
// @lc code=end

